import { ApiProperty } from '@nestjs/swagger'
import { IsDefined, IsInt, IsNotEmpty } from 'class-validator'

/*
 * @Description:
 * @Author: fhw
 * @Date: 2022-08-02 14:41:43
 */
export class CreateSysMessageDto {
  @IsNotEmpty({ message: '消息标题不能为空' })
  @ApiProperty({
    type: String,
    name: 'message_title',
    description: '消息标题',
  })
  public readonly message_title: string

  @IsNotEmpty({ message: '消息内容不能为空' })
  @ApiProperty({
    type: String,
    name: 'message_content',
    description: '消息内容',
  })
  public readonly message_content: string

  @IsNotEmpty({ message: '消息类型不能为空' })
  @ApiProperty({
    type: Number,
    name: 'message_type',
    description: '消息类型',
  })
  public readonly message_type: number

  @IsNotEmpty({ message: '推送用户id不能为空' })
  @IsInt({ message: '推送用户id不是整数' })
  @IsDefined({ message: '推送用户id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'toUserId',
    description: '推送用户id',
  })
  public readonly toUserId: number

  @IsNotEmpty({ message: '创建人id不能为空' })
  @IsInt({ message: '创建人id不是整数' })
  @IsDefined({ message: '创建人id不能为空' })
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '创建人id',
  })
  public readonly userId: number

  @ApiProperty({
    type: Number,
    name: 'message_status',
    description: '消息状态',
    nullable: true,
  })
  public readonly message_status?: number

  @ApiProperty({
    type: Number,
    name: 'status',
    description: '状态',
    nullable: true,
    default: 0,
  })
  public readonly status?: number

  @ApiProperty({
    type: String,
    name: 'created_by',
    description: '创建人',
    nullable: true,
    default: '',
  })
  public readonly created_by?: string
}

export class UpdateSysMessageDto {
  @ApiProperty({
    type: String,
    name: 'message_title',
    description: '消息标题',
  })
  public readonly message_title?: string

  @ApiProperty({
    type: String,
    name: 'message_content',
    description: '消息内容',
  })
  public readonly message_content?: string

  @ApiProperty({
    type: Number,
    name: 'status',
    description: '状态',
    nullable: true,
    default: 0,
  })
  public readonly status?: number

  @ApiProperty({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id: number
}
export class GetSysMessageInfoDto {
  @ApiProperty({
    type: Number,
    name: 'userId',
    description: '创建人id',
  })
  public readonly userId?: number

  @ApiProperty({
    type: Number,
    name: 'toUserId',
    description: '推送用户id',
  })
  public readonly toUserId?: number

  @ApiProperty({
    type: Number,
    name: 'id',
    description: 'id',
  })
  public readonly id?: number
}
